home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12369 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  55 lines

  1. Newsgroups: comp.lang.c++
  2. Path: in2.uu.net!world!mv!usenet
  3. From: ENGR@GSSI.MV.COM (Michael Furman)
  4. Subject: Re: Leap year
  5. Message-ID: <DoJ0ny.IHC@mv.mv.com>
  6. Mime-Version: 1.0
  7. Content-Type: Text/Plain; charset=US-ASCII
  8. Organization: GSSI
  9. Date: Tue, 19 Mar 1996 17:59:58 GMT
  10. References: <3135A7F2.2120@hiwaay.net> <4hbiln$899@sam.inforamp.net> <65AVgFvrnTB@softsite.co.at>
  11. X-Newsreader: WinVN 0.99.7
  12. X-Nntp-Posting-Host: gssi.mv.com
  13.  
  14. In article <65AVgFvrnTB@softsite.co.at>, wsog@softsite.co.at says...
  15. >
  16. >Poul A. Costinsky  (PoulACost@msn.com) wrote on 13.03.96
  17. >about "Re: Leap year":
  18. >
  19. >> return (!(y % 4) && (y % 100));
  20. >>
  21. >> Hope this helps.
  22. >
  23. >No, Poul, it don't think it helps him much if you post nonsense.
  24. >Please read the FAQ before posting.
  25.  
  26. It is better do not comment at all then post such comment! What FAQ you 
  27. suggest to read? There is nothing about that in C++ FAQ.
  28.  
  29. That is true that Poul's answer is not correct; for definition of leap
  30. years see homepage:
  31.   http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html
  32.  
  33. that contains a Summary of the International Standard Date and
  34. Time Notation:
  35.  
  36. Leap years are years with an additional day YYYY-02-29, where the year number 
  37. is a multiple of four with the
  38. following exception: If a year is a multiple of 100, then it is only a leap 
  39. year if it is also a multiple of 400. For
  40. example, 1900 was not a leap year, but 2000 is one.
  41. ===== End of citation ======
  42.  
  43. So, correct code would be:
  44.   return (!(y % 4) && (!(y % 400) || (y % 100)));
  45.  
  46. -- 
  47. <<< If you received it by E-mail: it is a copy of post to the newsgroup >>>
  48. ---------------------------------------------------------------
  49. Michael Furman,                       (603)893-1109
  50. Geophysical Survey Systems, Inc.  fax:(603)889-3984
  51. 13 Klein Drive - P.O. Box 97          engr@gssi.mv.com 
  52. North Salem, NH 03073-0097            71543.1334@compuserve.com
  53. ---------------------------------------------------------------
  54.  
  55.